# Calculate the CI of regressional parameters for linear regression
beta.ci <- function(fm, alpha=0.05){
  a <- summary(fm)$coefficients
  df <- fm$df.residual
  low <- a[,1] - a[,2] * qt(1-alpha/2, df)
  upper <- a[,1] - a[,2] * qt(1-alpha/2, df)
  rowname <- dimnames(a)[[1]]
  colname <- c('Estimate', 'Low', 'Upper')
  matrix(c(a[,1], low, upper), ncol=3,
         dimnames=list(rowname, colname))
}
